package com.xxx.springboot.service;

import java.util.concurrent.TimeUnit;

/**
 * 1. 【redis延时队列】添加/获取任务service接口
 */
public interface RedisDelayQueueService {

    /**
     * 往延时队列里添加任务
     * @param value
     * @param delayTime
     * @param timeUnit
     * @param queueName
     * @param <T>
     */
    <T> void addTaskIntoDelayQueue(T value, long delayTime, TimeUnit timeUnit, String queueName);

    /**
     * 从延时队列里获取任务
     * @param queueName
     * @param <T>
     * @return
     */
    <T> T getTaskFromDelayQueue(String queueName) throws InterruptedException;
}
